<template>
  <div>
    <iframe v-if="isLoad" id="mapIframe" ref="mapIframe" :width="'100%'" :height="height" src="http://d.myships.com:8091/haiyou/"></iframe>
    <div class="example"  v-else>
      <a-spin />
    </div>
  </div>
</template>

<script setup>
import {ref, onMounted} from 'vue'
const height = ref(window.screen.height)
const isLoad = ref(true)
const mapIframe = ref(null)
onMounted(() => {
  console.log('ifram', mapIframe.value)
  if (mapIframe.value) {
    if (mapIframe.value.attachEvent) {
      mapIframe.value.attachEvent('onload', () => {
        isLoad.value = true
        console.log('架子啊完成')
      })
    } else {
      mapIframe.value.onload = () => {
        isLoad.value = true
        console.log('架子啊完成')
      }
    }
  } else {
    setTimeout(() => {
      location.reload()
    }, 5000)
    isLoad.value = false
  }
})
</script>

<style scoped>
#mapIframe {
  border: 0;
}
</style>
